import './assets/main.css'
import './assets/styles/index.scss'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 引入Element Plus暗黑模式CSS
import 'element-plus/theme-chalk/dark/css-vars.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { useVXETable } from './plugins/vxe-table'

// 导入客户端应用初始化函数
import { initClientApp } from './client/main'

// 导入模拟数据配置（仅在开发环境中）
if (import.meta.env.MODE === 'development') {
  import('./mock').then(() => {
    console.log('Mock 数据已加载（开发环境）')
  })
}

import App from './App.vue'
import router from './router'

const app = createApp(App)

// 注册所有Element Plus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(createPinia())
app.use(router)
app.use(ElementPlus, { size: 'default', zIndex: 3000 })
useVXETable(app)

// 初始化客户端应用（注册组件和服务）
initClientApp(app)

app.mount('#app')
